package com.example.demo.service.Impl;

import com.example.demo.mapper.UsersMapper;
import com.example.demo.service.UsersService;
import com.example.demo.vo.ResponseVO;
import org.apache.catalina.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UsersServiceImpl implements UsersService {
    @Autowired
    private UsersMapper usersMapper;
    @Override
    public ResponseVO loginUsers(String username, String password) {
        User user=usersMapper.selectByusername(username);
        if(user == null){
            throw new IllegalArgumentException("该用户不存在");
        }
        if(password!=user.getPassword()){
            throw new IllegalArgumentException("密码错误");
        }
            return ResponseVO.success("登陆成功", user);
    }
}
